package text.ui;

import java.awt.BorderLayout;

import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class StatusViewer extends Viewer {

	private JTextArea textArea = null;
	
    /**
     * main method allows us to run as a standalone demo.
     */
    public static void main(String[] args) {
		StatusViewer defaultMode = new StatusViewer();
		defaultMode.init();
    }
    
    /**
     * StatusViewer Constructor
     */
    public StatusViewer() {
        // Set the title for this demo, and an icon used to represent this
        // demo inside the GUI app.
        super(null, "StatusViewer", "status.GIF");
        createTextArea();
    }

	private void createTextArea() {
		textArea = new JTextArea();
		textArea.setEditable(false);
		JScrollPane scroller = new JScrollPane();
		scroller.setViewportView(textArea);
		getViewerPanel().add(scroller, BorderLayout.CENTER);
	}
	
	public JTextArea getStatusField() {
		return textArea;
	}

	public void clearStatus() {
		textArea.setText("");
	}

	public void appendToStatus(String strText) {
		textArea.setText(textArea.getText()+"\n"+strText);
	}
}